home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
001
/
dialer.arc
/
DIALER.BAS
next >
Wrap
BASIC Source File
|
1987-08-04
|
31KB
|
1,036 lines
' DIALER.BAS - Memory resident phone dialer
' DIALER.EXE Copyright (C) 1987 MicroHelp, Inc.
' This program may be freely copied and distributed provided that
' all copyright notices are left intact and that you distribute all
' of the following programs in an unmodified state:
' DIALER.BAS, DIALER.EXE and DIALER.DOC
' -----------------------------------------------------------------------
' Start this program as DIALER/C if you wish to reconfigure it for
' different defaults (file names, hot key, snow checking). See note
' below if you recompile with MS 5.36 or IBM BASCOM 1.0
' -----------------------------------------------------------------------
' In order to recompile this program, you need "Mach 2" (assembler
' subroutine library) and "Stay-Res" (makes compiled BASIC programs
' memory resident), both available from MicroHelp, Inc. "Mach 2" is $69.00
' and "Stay-Res" costs $69.00. In order to use EMS memory or "disk
' swapping" with "Stay-Res", you need the optional "EMS/Disk module",
' which costs $50.00. (If you purchase the EMS/Disk module at the same time
' you get Stay-Res, the "combo" price is $99.00.) Note that the EMS/Disk
' module is not required -- what it does is to allow your programs
' to run in only 7K of DOS memory. Without the module, this program
' will require approximately 110-120k of memory (depending upon the
' compiler used).
' -----------------------------------------------------------------------
' This program was written with line numbers (instead of labels) so that
' it can be compiled with QuickBASIC 1.xx and 2.xx as well as IBM BASCOM
' 1.0 and 2.0 and Microsoft generic BASIC compiler version 5.36. With all
' of the aforementioned compilers EXCEPT QuickBASIC, you must use
' the /n switch (line numbers not required) when compiling. Due to
' a bug in DOS 2.xx, if this program is compiled with QuickBASIC 2.x, it
' requires DOS 3.0 or later to run. The DOS bug is the same one mentioned
' in the diskette documentation on the QuickBASIC 2.01 distribution
' diskette (explains why SHELL doesn't always work with DOS 2.x).
' Note also that with MS 5.36 compiler, the hardware specific commands
' LOCATE, CLS and COLOR must be changed and you must compile with
' the /n switch (relax line numbering requirements).
' Lastly, the program reads the command line (COMMAND$) to check for
' a /C. If you have the MS 5.36 or IBM BASCOM 1.0 compiler, the command
' line is not passed to your program. Another MicroHelp product, "The
' Inside Track" can do it for you. Otherwise you'll have to change
' the program to automatically go into configuration mode.
' -----------------------------------------------------------------------
' In case you're interested, the distribution copy was compiled with
' QuickBASIC 1.02, since it produces the smallest .EXE files among the
' QB family. For the absolute smallest program,
' use Microsoft's generic BASIC compiler version 5.36 on your programs.
' Just beware that it does not have the IBM hardware commands such
' as LOCATE, COLOR and CLS and it does not support communications.
' -----------------------------------------------------------------------
' If you would like to order "Mach 2" or "Stay-Res", or for more information
' on any MicroHelp product, call 1-800-922-3383. In Georgia, call
' 404-973-9272. MasterCard and Visa are welcome as well as Purchase Orders
' from recognized organizations (Fortune 100 or governmental bodies).
' -----------------------------------------------------------------------
Defint A-Y ' for faster operation and less memory usage
' and so we don't have to type %
Defstr Z ' so we don't have to type $ all over the place
Dim Zphone.entry(200) ' names/phone numbers, etc. 200 entries
Dim Zmessage(3) ' for instructions on bottom 3 screen lines
' -----------------------------------------------------------------------
' This area sets up the buffer for storing the screen image when the
' program pops up. Stay-Res is capable of dynamically reserving memory
' (using memory outside of BASIC's data area) also, but we have enough
' room in the program to use string space - that means less memory is
' used to run the program.
Scr.buffer$=Space$(16404) ' for storing screen images
Kshift=varptr(Scr.buffer$) ' Stay-Res is used to determine
Operation=3 ' the segment address of this
gosub 50000 ' string. 50000 calls Stay-Res
Dtaseg=Kshift ' reserved memory segment
Kscan=16384 ' Tells Stay-Res to save up to 16384
Operation=4 ' bytes of memory for screen
gosub 50000 ' images.
True=-1 ' for testing variables in the program
False=0
One=1 ' for older compilers
Page=0 ' video page for Mach 2 routines
Invisible.cursor=&h1600
For n=1 to 3
Zmessage(n)=space$(80) ' for messages on lines 23-25
next
Operation=0 ' initialize the window manager
Buffer.number=1 ' number of buffers
Box=1024 ' Number of 1k blocks
gosub 50100 ' initialize the window manager
' -----------------------------------------------------------------------
' This area determines if a configuration file is present. If so, the
' file is loaded, otherwise the user can set up a configuration file.
' The configuration file has 7 pieces of data:
' Snow.checking = integer (true or false as above)
' Monitor.to.use 1=Mono, 2=Color, 3=Default
' Zdata.file = Phone directory data file name
' Scan.code = Hot key scan code
' Shift.status = Hot key shift status
' Zswap.path = Drive and path for disk swapping (DOS 3+ required)
' Port$ = COM1 or COM2
' Each entry in the phone directory can be up to 76 columns long.
' If there is a phone number, it should begin in column 56 or higher
' and can be up to 19 characters in length.
Snow.checking=True ' in case no config file
Monitor.to.use=3 ' ditto (default monitor)
Zdata.file="" ' in case no config file
Port$="COM1" ' ditto
gosub 51000 ' set up values for default monitor
if Monitor=&hb000 then Color 7,0,0 else Color 14,1,1
gosub 54000 ' display copyright notice
Spec$="Dialer.cnf"+chr$(0) ' configuration file name
gosub 54200 ' check for file presence
If Ecode then 2000 ' no configuration file available,
' so go to configuration setup.
On error goto 1500 ' if this isn't a valid file
Open "i",1,"Dialer.cnf" ' open the config file
1000
Input #1,Snow.checking
Input #1,Monitor.to.use
Input #1,Zdata.file
Input #1,Scan.code
Input #1,Shift.status
Input #1,Zswap.path
Input #1,Port$
Close
On error goto 0 ' no special error trapping for now
' -----------------------------------------------------------------------
' If you have MS 5.36 or IBM BASCOM 1.0 compiler, put in a "GOTO 2001" here
' -----------------------------------------------------------------------
z=Command$ ' doesn't work for MS 5.36 and IBM BASCOM 1.0
call Mhucase(z) ' convert to uppercase
if instr(z,"/C")=0 then 5000 ' not reconfiguring
goto 2001 ' reconfigure
' -----------------------------------------------------------------------
1500 ' If we get here, we had an invalid config file
Er%=0 ' clear the BASIC error
Resume 2000 ' do the config file setup
' -----------------------------------------------------------------------
2000 ' No configuration file was found, so we'll set it up.
' The Mhscr routine is the "instant screen display" routine
' found in Mach 2.
On error goto 0 ' no special error trapping for now
Close
gosub 51000 ' set up values for default monitor
gosub 54000 ' display copyright notice
Lin=10
z="Invalid or missing DIALER.CNF (configuration file)."
Call Mhscr(Page,z,Lin,One,Lowlight.color)
Lin=Lin+2
z="If you wish to continue, answer 'Y' to the following"
Call Mhscr(Page,z,Lin,One,Lowlight.color)
Lin=Lin+1
z="question. Any other key will end this program."
call Mhscr(Page,z,Lin,One,Lowlight.color)
Lin=Lin+2
z="Do you want to set up a configuration file?"
call Mhscr(Page,z,Lin,One,Lowlight.color)
' Now we'll clear the keyboard and get a key press
Lin=15
Column=45
Call Mhkclr (Stack$,Curs.normal,Lin,Column,Page,Kshift,Kscan,Kascii)
if Kscan=21 then z="Yes" else z="No" ' 21 is scan code for 'Y' and 'y'
call Mhscr(Page,z,Lin,Column,Highlight.color)' display the answer
if Kscan<>21 then 63000 ' didn't press 'Y'
2001 ' come here if reconfiguring
Restore 2000 ' set up data entry screen
For Lin=17 to 22
Read z
call Mhscr(Page,z,Lin,One,Lowlight.color)
next
data "Snow Checking . . . . . "
data "Monitor to use . . . . . :
data "Phone directory file name:
data "Press your hot key . . . :
data "Drive/path for swapping :
data "Communications port . . :
For Which.config=1 to 6
gosub 2900 ' display current data
next
Which.config=1 ' start configuring with Snow.checking
' -----------------------------------------------------------------------
' Configuration input area
2010 ' display messages
on Which.config goto 2100,2200,2300,2400,2500,2600
2100 ' Snow checking
Restore 2100
goto 2800
data "Use space bar to toggle snow checking on and off.
data "Note that snow checking is not used on a monochrome monitor.
2200 ' Monitor to use
Restore 2200
goto 2800
data "Use space bar to toggle which monitor to use when this program
data "becomes memory resident. Default means current monitor is used.
2300 ' Telephone directory name
Restore 2300
goto 2800
data "Enter the default file name for your telephone directory.
data "You may include a disk drive and path."
2400 ' Hot key to activate program
Restore 2400
goto 2800
data "Press Ctrl and/or Alt and/or Shift and another key that you wish to use to
data "popup this program up after it has become memory resident.
2500 ' Drive/path for swapping
restore 2500
goto 2800
data "Please enter the drive and path to use for disk swapping.
data "This option requires DOS 3 or later. See DIALER.DOC if questions.
2600 ' Com port
restore 2600
goto 2800
data "Use the space bar to toggle between COM1 and COM2.
data ""
2800 ' get input here at column 28
for n=1 to 2 ' read messages
read z
lset Zmessage(n)=z
next
lset Zmessage(3)="<Enter>=Accept Esc=End program F1=Save data/go resident
gosub 54100 ' display all messages
2805 ' come here to redo input
gosub 2900 ' display current item
Colr=Highlight.color
if Which.config=3 or Which.config=5 then 2810' for edited input
' Now we'll clear the keyboard and get a key press
Column=28
Call Mhkclr (Stack$,Curs.normal,Lin,Column,Page,Kshift,Kscan,Kascii)
goto 2820
2810 ' edited input
Fill.character=32
Response.actual$=space$(50) ' max allowable characters
Call MhInput (Stack$,Response.default$,Highlight.color,Curs.normal,Curs.insert,Fill.character,Lin,Column,Page,False,False,False,Kshift,Kscan,Kascii,Response.actual$,Ecode)
n=instr(Response.actual$,chr$(0))
if n then Response.actual$=left$(Response.actual$,n-1)
2820 ' check results
on Which.config gosub 3100,3200,3300,3400,3500,3600
gosub 2900 ' display data
if Kscan=59 and Kshift=0 then 4000 ' F1 to save config file
if Kscan=1 and Kshift=0 then 63000 ' end program
if Kshift=0 and (Kscan=28 or Kscan=80) then 2850 ' return/down arrow
if Kshift=0 and Kscan=72 then 2860 ' up arrow
goto 2805 ' redo input
2850 ' next item
Which.config=Which.config+1
if Which.config>6 then Which.config=1
goto 2010
2860 ' previous item
Which.config=Which.config-1
if Which.config<1 then Which.config=6
goto 2010
' -----------------------------------------------------------------------
2900 ' Displays the current status of one configuration item
Lin=Which.config+16
on Which.config goto 2910,2920,2930,2940,2950,2960
2910 ' snow checking
if Snow.checking then z="On " else z="Off
goto 2980
2920 ' monitor
z=mid$("Mono Color Default",(Monitor.to.use-1)*7+1,7)
goto 2980
2930 ' phone directory filename
z=Zdata.file
goto 2980
2940 '
z="Scan code:"+Str$(Scan.code)+" Shift status: "
if (Shift.status and 1)=1 then z=z+"Shift "
if (Shift.status and 4)=4 then z=z+"Ctrl "
if (Shift.status and 8)=8 then z=z+"Alt"
if Shift.status=0 or Scan.code=0 then z="Not yet selected
goto 2980
2950 ' drive/path for swapping
z=Zswap.path
goto 2980
2960 '
z=Port$
goto 2980
2980 ' display the current data
Response.default$=z ' for edited input if necessary
z=z+space$(50-len(z)) ' to clear the rest of the line
Column=28
call Mhscr(Page,z,Lin,Column,Highlight.Color)
2990 Return
' -----------------------------------------------------------------------
3100 ' snow checking
if Kscan=57 then Snow.checking=Snow.checking xor True ' toggle it
Return
' -----------------------------------------------------------------------
3200 ' monitor
if Kscan=57 then Monitor.to.use=Monitor.to.use+1:If Monitor.to.use>3 then Monitor.to.use=1
Return
' -----------------------------------------------------------------------
3300 ' Data file
Zdata.file=Response.actual$
Return
' -----------------------------------------------------------------------
3400 ' Hot key
if Kshift=0 then return ' must be a shifted key
Scan.code=Kscan
Shift.status=Kshift
Return
' -----------------------------------------------------------------------
3500 ' swapping
Zswap.path=Response.actual$
Return
' -----------------------------------------------------------------------
3600 ' Com port
if Kscan=57 then If Port$="COM1" then Port$="COM2" else Port$="COM1"
return
' -----------------------------------------------------------------------
4000 ' save config file
Open "o",1,"Dialer.cnf" ' open the config file
Write #1,Snow.checking,Monitor.to.use,Zdata.file,Scan.code,Shift.status,Zswap.path,Port$
Close
' -----------------------------------------------------------------------
5000 ' set up monitor, colors and read data file
gosub 54000 ' print copyright notice
Spec$=Zdata.file+chr$(0)
gosub 54200 ' check file presence
if Ecode then 5100 ' not found
if Scan.code=0 or Shift.status=0 then 5200 ' no hot key
if Zswap.path="" then 10000 ' no need to check path
Call Mhdver(Major,Minor) ' get DOS version
if Major<3 then z="Disk swapping requires DOS 3.0 or later!":goto 62000
if right$(Zswap.path,1)="\" then Zswap.path=left$(Zswap.path,Len(Zswap.path)-1)
Operation=7
kshift=varptr(Zswap.path)
gosub 50000 ' call stayres
if ecode=False then 10000 ' no error
z="Unable to use "+zswap.path+" for swapping.
goto 62000
5100 ' no data file
print
print "Unable to locate "+Zdata.file
goto 5900
5200 ' invalid hot key
print
print "Invalid or no hot key selected.
5900 print "Press a key for the configuration menu ";
z=input$(1)
goto 2001
' -----------------------------------------------------------------------
10000 ' become memory resident
Operation=5 ' check if EMS memory is available
gosub 50000 ' call Stay-Res
if Ecode=False and Zswap.path="" then print "EMS memory will be used for program storage.
print
print "Loading ";Zdata.file;
gosub 55000 ' load the file
gosub 56000 ' get date and time of file
ztime=Tim$
zdate=Dat$ ' save for checking later
10100 ' final setup
print
if Total.records=0 then z="No entries in telephone directory.":goto 62000
if Snow.checking=False then Ecode=100 ' tell Stay-Res
Start.data=1 ' first phone number to display
Current.line=2 ' line to highlight
locate ,,1 ' visible cursor in DOS please
Zmessage(1)="" ' no longer needed
Zmessage(2)=Space$(76) ' new message string
Zmessage(3)=Zmessage(2) ' ditto
' -----------------------------------------------------------------------
11000 ' This is where we become memory resident and go back to sleep again
Operation=0
Kshift=Shift.status
Kscan=Scan.code
gosub 50000 ' call Stay-Res
on error goto 40000 ' trap BASIC errors at 40000
on Monitor.to.use gosub 53000,52000,51000 ' set up values
call Mhvideo(Monitor)
If Snow.checking=False then n=&hffff:call Mhvideo(n) ' tell Mach 2 no snow checking
if Ecode>1 then z="Error"+str$(Ecode)+" when attempting to become memory resident.":goto 62000
if Ecode<>0 or Kscan>7 then gosub 54300:goto 11000' DOS not available or bad video mode - go back to sleep
Def seg=0
Current.Monitor=peek(&h410)
Def seg
if (Current.Monitor AND &h30)=&h30 then Current.monitor=&hb000 else Current.monitor=&hb800
if Current.monitor=Monitor then 11100 ' if the same, the screen has been saved by Stay-Res
Memory$=space$(4000) ' to hold the current video memory
' on the other monitor
A!=varptr(memory$)
A=PEEK(A!+2) ' due to bug in QB 2, all this rigamorol is necessary
A!=(PEEK(A!+3)) ' address of string
A!=A!*256+a
n=val("&h"+hex$(A!)) ' convert to integer
a=4000
Column=&hffff
Call Mhmove (Monitor,Page,a,column,n) ' save the screen
goto 12000 ' we must assume text mode
11100 ' Current monitor and our monitor are the same
if Kscan=2 or Kscan=3 or Kscan=7 then 12000 ' no need change mode
If Monitor=&hb000 then Kscan=7 else Kscan=3 ' mono/color modes
Operation=2 ' set video mode
gosub 50000 ' let Stay-Res do it.
12000 ' draw our screen
z=space$(80) ' can't do CLS, since we
for Lin=1 to 25 ' might be on alternate monitor
call Mhscr(Page,z,Lin,one,Lowlight.color)
next
Top.row=1 ' draw a box
Left.column=1
Bottom.row=25
Right.column=80
box=2
Colr=Highlight.color
Operation=4
gosub 50100 ' call the window manager
z=chr$(181)+" MicroHelp Dialer Program (404) 973-9272 "+chr$(198)
Column=20
call Mhscr(Page,z,One,Column,Highlight.color) ' display our banner
z=chr$(199)+string$(78,196)+chr$(182) ' to draw a line near bottom
Column=22
call Mhscr(Page,z,Column,One,Highlight.color)
gosub 56000 ' get date/time of phone directory
if Ecode then Ecode=0:goto 12100 ' error on open
if ztime=Tim$ and zdate=dat$ then 12100 ' file has not changed
12050 Restore 12050
gosub 54150 ' display two messages
data Reloading telephone directory due to change in file . . .
data ""
ztime=Tim$ ' reset for next time
Zdate=dat$
gosub 55000 ' reload the file
12100 ' display some data
z=space$(76)
Column=3
For Lin=2 to 21
Lset z=Zphone.entry(Lin+Start.data-2) ' which entry
call Mhscr(Page,z,Lin,Column,Lowlight.color) ' display it
if z<>space$(76) then Last.line.with.data=Lin ' for movement keys
Next
12200 ' highlight current record by changing color attributes
Column=3
n=76
Call Mhscatt(Page,Current.Line,Column,Inverse.color,n)
12300 ' display message and get input
restore 12300
data "Press <Enter> to dial PgUp PgDn to change selection"
data Esc=Go back to sleep F2=Disappear from memory F3=Search Directory
gosub 54150 ' display two messages
12310 ' clear keyboard and get key with invisible cursor
Lin=26
Call Mhkclr (Stack$,Invisible.cursor,Lin,One,Page,Kshift,Kscan,Kascii)
if Kscan=28 then 12400 ' dial current number
if Kscan=72 then 12500 ' up arrow
if Kscan=80 then 12600 ' down arrow
if Kscan=73 then 12700 ' pgup
if Kscan=81 then 12800 ' pgdn
if Kscan=60 then 13000 ' F2 disappear from memory
if Kscan=61 then 13100 ' F3 search
if Kscan=1 then gosub 12900:goto 11000 ' Esc back to sleep
goto 12310 ' invalid key
12400 ' dial it
z=space$(19) ' string to read number into
n=19
Column=58
Call Mhrscr(Page,z,Current.Line,Column,n) ' read number from screen
if z=space$(19) then gosub 54300:goto 12310 ' no number there!
on error goto 12450 ' modem errors
Close
Open "r",1,Port$+":300,E,7,1,CS,DS,CD"
print #1, "ATM1 S11=40DT"+z
on error goto 40000 ' BASIC errors
12410 ' get instructions
restore 12410
data "Press <Enter> when party answers or to return to menu
data R=Redial
gosub 54150 ' display two messages
12420 ' get a key
Lin=23
Column=58
Call Mhkclr (Stack$,Curs.normal,Lin,Column,Page,Kshift,Kscan,Kascii)
if Kscan=28 then gosub 12440:goto 12300 ' escape
if Kscan=19 then gosub 12440:goto 12400 ' hangup and redial
goto 12420 ' get another key
12440 ' hangup the phone
on error goto 12450
print #1, "ATM1 H0 Z" 'hang up
close
on error goto 40000
Return
12450 ' phone/modem error
z=space$(76)
lset z="Modem error"+str$(err)
er%=0
resume 12460
12460 ' continue with error
on error goto 40000
Lin=23
Column=3
call Mhscr(Page,z,Lin,Column,Highlight.color)
lset z="Press a key.
Lin=24
call Mhscr(Page,z,Lin,Column,Highlight.color)
Column=16
Call Mhkclr (Stack$,Curs.normal,Lin,Column,Page,Kshift,Kscan,Kascii)
goto 12300
12500 ' up arrow pressed
Column=3 ' un-highlight current selection
n=76
Call Mhscatt(Page,Current.Line,Column,Lowlight.color,n)
Current.line=Current.line-1
if Current.line=1 then Current.line=Last.line.with.data
goto 12200 ' highlight current line
12600 ' down arrow pressed
Column=3 ' un-highlight current selection
n=76
Call Mhscatt(Page,Current.Line,Column,Lowlight.color,n)
Current.line=Current.line+1
if Current.line>Last.line.with.data then Current.line=2
goto 12200 ' highlight current line
12700 ' Pgup pressed
if Total.records<20 then 12300 ' no more records
Current.line=2 ' current line is top line
if Start.data=1 then Start.data=Total.records-19:goto 12100
Start.data=Start.data-20
if Start.data<1 then Start.data=1
goto 12100
12800 ' Pgdn pressed
if Total.records<20 then 12300 ' no more records
Current.line=2 ' current line is top line
Start.data=Start.data+20
if Start.data>Total.records then Start.data=1
goto 12100
12900 ' Restore alternate monitor if necessary
if Current.monitor=Monitor then return ' no need restore screen
A!=varptr(memory$)
A=PEEK(A!+2) ' due to bug in QB 2, all this rigamorol is necessary
A!=(PEEK(A!+3)) ' address of string
A!=A!*256+a
n=val("&h"+hex$(A!)) ' convert to integer
ffff=&hffff
Bytes=4000
Call Mhmove (ffff,n,bytes,Monitor,Page) ' restore the screen
return
13000 ' disappear from memory
restore 13000
gosub 54150 ' display two message
data Do not disappear from memory if any other program is running or you loaded
data any other resident programs after this. Do you still want to disappear?
Column=75
Call Mhkclr (Stack$,Curs.normal,Lin,Column,Page,Kshift,Kscan,Kascii)
if kscan<>21 then 12300 ' if didn't press 'Y'
gosub 12900 ' restore screen
Operation=9
gosub 50000 ' call stayres
' if we get back from the call to Stay-Res, it means we were unable
' go disappear from memory
13050 restore 13050
data Unable to disappear from memory at this time.
data Press any key to go back to sleep.
gosub 54150 ' display two message
Column=39
Call Mhkclr (Stack$,Curs.normal,Lin,Column,Page,Kshift,Kscan,Kascii)
goto 12300
13100 ' search phone directory
data "Please enter the characters to search for ('Esc' cancels search):
data ""
restore 13100
gosub 54150 ' display two message
Response.default$=Search.string$ ' repeat if previously searched
lset zmessage(3)=Response.default$
call Mhscr(Page,zmessage(3),Lin,Column,Highlight.color) ' display default response
Fill.character=32
Response.actual$=space$(50) ' max allowable characters
Call MhInput (Stack$,Response.default$,Highlight.color,Curs.normal,Curs.insert,Fill.character,Lin,Column,Page,False,False,False,Kshift,Kscan,Kascii,Response.actual$,Ecode)
if Kscan=1 then 12300 ' escape pressed
n=instr(Response.actual$,chr$(0))
if n then Response.actual$=left$(Response.actual$,n-1)
Search.string$=Response.actual$ ' save for repeated searches
z=Search.string$ ' so we can convert to
call Mhucase(z) ' upper case for comparison (i.e. ignore case)
if Search.start=0 or Search.start>Total.records then Search.start=1
' Search.start is the record at which the next search will begin
Temp=Search.start ' start looking here
13200 '
z2=Zphone.entry(Temp) ' so we can convert to
call Mhucase(z2) ' upper case for search
if instr(z2,z) then 13500 ' Found one!
if Total.records=1 then 13300 ' just in case
Temp=temp+1 ' didn't find one
if Temp=Search.start then 13300 ' end of file reached without finding a match
if Temp<=Total.records then 13200 ' keep looking
if Search.start=1 then 13300 ' no need to wrap
Temp=1 ' wrap around
goto 13200
13300 ' end of file - no match
restore 13300
gosub 54150 ' display two message
data No match found.
data Press a key to continue
Column=27
Call Mhkclr (Stack$,Curs.normal,Lin,Column,False,Kshift,Kscan,Kascii)
goto 12300
13500 ' found a string
Start.data=(Temp+9)/20 ' appropriate page
Start.data=(Start.data-1)*20+1 ' start display with this item
Current.line=Temp-Start.data+2 ' flag for highlight routine
Search.start=Temp+1 ' mark the next one
goto 12100 ' display the data
' -----------------------------------------------------------------------
40000 ' trap BASIC errors here
z="BASIC error"+str$(err)+" encountered at line"+str$(erl)+". Press a key."
er%=0
resume 40010
40010
Lin=24 ' display BASIC error message
Column=3
call Mhscr(Page,z,Lin,Column,Lowlight.color)
Column=75
Call Mhkclr (Stack$,Curs.normal,Lin,Column,False,Kshift,Kscan,Kascii)
gosub 12900 ' back to sleep
goto 11000
' -----------------------------------------------------------------------
50000 Call Stayres(Operation,Kscan,Kshift,Ecode)
Return
' -----------------------------------------------------------------------
50100 ' Calls the Mach 2 window manager - we'll use it to draw boxes
Call Mhwind (Stack$,Colr,Dtaseg,Operation,Page,Top.row,Left.column,Bottom.row,Right.column,Buffer.number,Box,Ecode)
Return
' -----------------------------------------------------------------------
51000 ' sets up values for default monitor
Def seg=0
Monitor=peek(&h410) ' equipment byte
Def seg
if (Monitor AND &h30)=&h30 then 53000 ' monochrome
52000 ' sets up values for color monitor
Monitor=&hb800 ' color monitor memory
Lowlight.color=27
Highlight.color=30
Inverse.color=113
Curs.normal=1543 ' same as locate ,,,6,7
Curs.insert=1031 ' same as locate ,,,4,7
locate ,,0,6,7
Return
53000 ' sets up values for monochrome monitor
Monitor=&hb000 ' mono monitor memory
Lowlight.color=7
Highlight.color=15
Inverse.color=112
Curs.normal=3085 ' same as locate ,,,12,13
Curs.insert=1293 ' same as locate ,,,5,13
locate ,,0,12,13
Return
54000 ' display the copyright screen
restore 54000
Cls
Top.row=1 ' we'll draw a box
Left.column=1
Bottom.row=9
Right.column=80
Box=2 ' double line
Operation=4 ' tells window manager to draw a box
Colr=Highlight.color
gosub 50100 ' call the window manager
Column=7
for Lin=2 to 8
read z
call Mhscr(Page,z,Lin,Column,Lowlight.color)
next
locate 10,1
return
data "DIALER.EXE Copyright (C) 1987 MicroHelp, Inc.
data ""
data "This program may be freely copied and distributed provided that
data "all copyright notices are left intact and that you distribute all
data "of the following files in an unmodified state:
data ""
data " DIALER.BAS, DIALER.EXE and DIALER.DOC
54100 ' display instructions on bottom 3 screen lines
For Lin=23 to 25
n=Lin-22
call Mhscr(Page,Zmessage(n),Lin,One,Highlight.color)
next
Return
54150 ' display instructions on bottom 2 screen lines
' RESTORE linenumber has been done before calling this routine
read z
lset Zmessage(2)=z
Lin=23
Column=3
call Mhscr(Page,Zmessage(2),Lin,Column,Highlight.color)
read z
lset Zmessage(3)=z
Lin=24
call Mhscr(Page,Zmessage(3),Lin,Column,Highlight.color)
Return
54200 ' check for file presence. come in with Spec$ set to ASCIIZ string
Fil.name$=space$(13) ' the assembler routine returns the file name
Call Mhfind (Stack$,Spec$,n,Fil.name$,One,Ecode)
Return
54300 ' make some noise - this works with compiled or interpreted BASIC!
OUT &H43,182' set up for sound
OUT &H42,&H33' low part of sound
OUT &H42,5' high part
N=INP(&H61):N1=N' save for later
N=N OR 3
OUT &H61,N' turn on speaker
FOR A!=1 TO 500:NEXT' delay
OUT &H42,&H33' low part
OUT &H42,6' high part
FOR A!=1 TO 500:NEXT' delay
OUT &H61,N1' turn off speaker
RETURN
55000 ' load the telephone directory
Close
Open "i",1,Zdata.file
Total.records=0
55010 ' read next record
if eof(1) then 55090 ' no more data
Total.records=Total.records+1
Line input #1,z
Zphone.entry(Total.records)=space$(76)
lset Zphone.entry(Total.records)=z
if Total.records<200 then 55010
55090 close
return
56000 ' get date and time of phone directory file
Fil.name$=Zdata.file+chr$(0) ' file name must be ASCIIZ string
Call Mhfile (Stack$,False,Fil.name$,False,Attributes%,Handle%,Ecode%) ' open the file
if Ecode then 56010 ' get out if error
Tim$="00:00:00"
Dat$="00/00/00"
Call Mhfdate (Stack$,Handle%,One,Tim$,Dat$,Ecode%) ' get date/time
Fil.name$="" ' close the file
Call Mhfile (Stack$,False,Fil.name$,False,Attributes%,Handle%,Ecode%) ' open the file
56010 return
62000 ' program end with error
locate 23,1
print z ' error message
print
print "Program will not be memory resident.
print
63000 ' program end
color 7,0,0
locate 25,1
End